import Vue from 'vue'
import axios from 'axios'

import App from './App'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import VueVideoPlayer from 'vue-video-player'
// import 'video.js/dist/video-js.css'

// Vue.use(VueVideoPlayer)


if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.http = Vue.prototype.$http = axios
Vue.config.productionTip = false

Vue.use(ElementUI);

// 事件车（事件总线）
Vue.prototype.$EventBus = new Vue()

//  转换播放量
Vue.filter("playCount", function (count) {
  if (count > 10000) {
    count = Math.ceil(count / 10000) + "万"
  }
  return count
})
// 转换时间
Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

// 转换播放时间
Vue.filter("formDate", function (date) {
  var m = parseInt(date / 1000 / 60)
  if (m < 10) {
    m = "0" + m
  }
  var s = parseInt((date / 1000) % 60)
  if (s < 10) {
    s = "0" + s
  }
  return m + ":" + s
})


/* eslint-disable no-new */
new Vue({
  components: { App },
  router,
  store,
  template: '<App/>'
}).$mount('#app')
